package com.tencreat.service.pay;

import com.alibaba.fastjson.JSONObject;
import com.tencreat.common.core.domain.model.LoginUser;
import com.tencreat.domain.mall.MallOrder;
import com.tencreat.domain.mall.MallOrderGoods;
import com.tencreat.domain.mall.dto.OrderMallSubmitDTO;

import java.math.BigDecimal;


public interface TradeService {
    /**
     * 统一生成订单
     *
     * @param orderParam
     * @param loginUser
     * @param paySuccess
     * @return
     */
    JSONObject generateTrade(
            OrderMallSubmitDTO orderParam, LoginUser loginUser, PaySuccess paySuccess);

    interface PaySuccess {
        JSONObject afterPaySuccess(String tradeId, JSONObject jsonObject) throws Exception;

        void onWxPaySuccess(String tradeId, String wxTradeId, JSONObject jsonObject);

        void onTradeSuccess(String tradeId);
    }

    /**
     * 支付成功统一业务回调
     *
     * @param payId 付款编号
     * @param order 订单对象
     */
    void afterPaySuccess(String payId, MallOrder order);

    void orderGoodsIncome(MallOrderGoods orderGoods);
}
